package ctbu.edu.cn.dp101.controller;

import ctbu.edu.cn.dp101.entity.Student;
import ctbu.edu.cn.dp101.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping("/student")
public class StudentController {

    @Autowired
    private StudentService studentService;

    /**
     * 使用thymeleaf的模板引擎来显示数据
     * @return
     */
//    @GetMapping("/list")
//    public String getList(Model model) {
//
//        List<Student> students = studentService.getAll();
//
//        model.addAttribute("students", students);

    /**
     * 使用ajax来显示数据
     * @return
     */
    @GetMapping("/list")
    public String getList() {

        return "/student/list";
    }
}
